const router = require("koa-router")();
const { login, register } = require("../controller/userController");
const {
    findUserInfoByUserId,
    updateUserInfo,
} = require("../controller/userInfoController");
const koaJWT = require("koa-jwt");
const secret = process.env.SECRET_KEY;

// 登陆注册接口
router.post("/register", register);
router.post("/login", login);

// 用户信息接口
router.get("/userInfo/:UserId", findUserInfoByUserId);
router.put("/userInfo/:UserId", updateUserInfo);

// 测试接口
router.get("/test", koaJWT({ secret }), async (ctx, next) => {
    ctx.body = "文章列表";
});
module.exports = router;
